import { RESPONSE_CODE } from "@/common/config";
import { handleShopChannelCategories } from "@/common/service";
import { showToast } from "@/common/util";
import { IChannelCategories, IChannelCategoriesItem, IResponseSuccess } from "@/typing";
import { makeAutoObservable } from "mobx";

class JobStore {
    channelCategoriesList: IChannelCategoriesItem[] = [];

    constructor() {

        makeAutoObservable(this)
    }
    async handleInitJobList() {
        try {
            const { data: { code, data } } = await handleShopChannelCategories() as IResponseSuccess<IChannelCategories>;

            if (code === RESPONSE_CODE.SUCCESS) {
                this.channelCategoriesList = data

            } else if (code === RESPONSE_CODE.ERROR) {
                throw new Error("请求异常");

            }
        } catch (error) {
            showToast('请求失败，请重试')


            console.error('Error fetching profile info:', error);
        }
    }
}
export default JobStore;